<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.jiuqi.webtree.util.StringUtils"%>
<%@page import="com.infomanage.service.syscfg.DepartService"%>
<%@page import="com.infomanage.po.Department"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
    request.setCharacterEncoding("UTF-8");
	String parent = request.getParameter("parent");
	List<Department> list = DepartService.loadDeptByParentId(request, response, out);
%>
<html>
<head>
	<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<link href="../../css/style.css" rel="stylesheet" type="text/css">
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="../../js/common.js"></script>
	<style type="text/css">
	</style>
	<script type="text/javascript">
		function editDepartment(deptId){
			var url = "department_edit.jsp?parent=" + '<%=parent%>' +"&itemId=" + deptId;
			var width = '450px';
			var height ='400px';
			var arg = "dialogHeight:" + height + ";dialogWidth:" + width + ";status:no;location:no;";
			var returnValue = window.showModalDialog(url, "", arg);
			if(returnValue){
				parent.frm_left.location.reload();
			}
		}

		function delDepartment(deptId){
			if(window.confirm("确认要删除该单位？")){
				actionFrame.location.href = "department_action.jsp?actionType=del&itemId=" + deptId;
			}
		}

	   function showInfo(info){
		   if(info && info != "") {
		   		alert(info);
		   }
		   window.location.reload();
		   parent.frm_left.location.reload();
	   }
	   
	   function showError(info){
		   if(info && info != "") {
		   		alert(info);
		   }
	   }
	
	</script>
</head>
<body rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" >	
<table width="100%" height="100%"  border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout: fixed;background: #ffffff;">
	<tr height="29px">
        <td valign="middle" height="29px" class="td_title" style="padding-left:20px;border-right: 1px #a3c6e2 solid;">
        	单位列表
        </td>
    </tr>
    <tr>
    	<td valign="top">
    		 <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="tabMain">
    		 	<col width="15%">
    		 	<col width="20%">
    		 	<col width="15%">
    		 	<col width="15%">
    		 	<col width="15%">
    		 	<col width="10%">
    		 	<col width="10%">
         		<tr class="thlist">
         			<td>
         				单位名称
			    	</td>
			    	<td>
			    		单位全称
			    	</td>
			    	<td>
			    		地理位置
			    	</td>
			    	<td>
			    		联系电话
			    	</td>
			    	<td>
			    		地址
			    	</td>
			    	<td>
			    		修改
			    	</td>
			    	<td>
			    		删除
			    	</td>
         		</tr>
         		
         		<!-- 输出数据 -->
         		<tr valign="top">
         			<td colspan="9" width="100%">
         				<div style="width: 100%;height: 100%;overflow: auto;">
         					<table width="100%" class="altColorTable" cellpadding="0" cellspacing="0">
				    		 	<col width="15%">
				    		 	<col width="20%">
				    		 	<col width="15%">
				    		 	<col width="15%">
				    		 	<col width="15%">
				    		 	<col width="10%">
				    		 	<col width="10%">
				    		 	<%
				    		 		for(Department org : list){
				    		 	%>
         						<tr class="tdlist">
         							<td>
         								<%= org.getName() %>
         							</td>
         							<td>
         								<%= org.getPath() %>
         							</td>
         							<td>
         								<%= StringUtils.isEmpty(org.getLatlng()) ? "" : org.getLatlng()%>
         							</td>
         							<td>
         								<%= StringUtils.isEmpty(org.getTelephoneNo()) ? "" : org.getTelephoneNo() %>
         							</td>
         							<td>
         								<%= StringUtils.isEmpty(org.getAdress()) ? "" : org.getAdress()%>
         							</td>
         							<td>
         								<img src="../../img/dot_xg.gif" border="0" onclick="editDepartment(<%= org.getDeptId() %>);" title="修改" style="cursor: hand">
         							</td>
         							<td>
         								<img src="../../img/dot_sc.gif" border="0" onclick="delDepartment(<%= org.getDeptId() %>);" title="删除" style="cursor: hand">
         							</td>
         						</tr>
         						<%
				    		 		}
         						%>
         					</table>
         				</div>
         			</td>
         		</tr>
         	 </table>
    	</td>
    </tr>
</table>
</body>
<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</html>
